package com.Calculator.view.Panel.impl;

import com.Calculator.models.impl.Theme;
import com.Calculator.view.Button.impl.CommandsButton;
import com.Calculator.view.Button.impl.FunsButton;
import com.Calculator.view.Button.impl.KeysButton;
import com.Calculator.view.Panel.iMyJPanel;

import javax.swing.*;
import java.awt.*;

public class ButtonPanel implements iMyJPanel{
    //button面板
    private JPanel buttonPanel;

    public ButtonPanel(Theme theme) {
        //设置布局
        buttonPanel = new JPanel(new BorderLayout());
        //设置大小
        buttonPanel.setPreferredSize(new Dimension(theme.getWidth(), theme.getHeight()*40/60));
        //设置边框
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        //设置背景颜色
//        buttonPanel.setBackground(Color.green);

        //func组件
        FunsButton funs = new FunsButton(theme);
        buttonPanel.add(funs.setPanel(),BorderLayout.EAST);

        //key组件
        KeysButton keys = new KeysButton(theme);
        buttonPanel.add(keys.setPanel(),BorderLayout.CENTER);

        //command组件
        CommandsButton commands = new CommandsButton(theme);
        buttonPanel.add(commands.setPanel(),BorderLayout.NORTH);

    }

    @Override
    public JPanel getJPanel() {
        return buttonPanel;
    }

    @Override
    public void setJPanel(JPanel jPanel) {
        this.buttonPanel = jPanel;
    }
}
